.class public Lcom/netease/newsreader/util/MergeAdapter;
.super Landroid/widget/BaseAdapter;
.source "MergeAdapter.java"

# interfaces
.implements Landroid/widget/SectionIndexer;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/netease/newsreader/util/MergeAdapter$CascadeDataSetObserver;,
        Lcom/netease/newsreader/util/MergeAdapter$EnabledSackAdapter;
    }
.end annotation


# instance fields
.field private pieces:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Landroid/widget/ListAdapter;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 38
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 26
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    .line 38
    return-void
.end method


# virtual methods
.method public addAdapter(Landroid/widget/ListAdapter;)V
    .locals 2
    .parameter "adapter"

    .prologue
    .line 47
    iget-object v0, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 48
    new-instance v0, Lcom/netease/newsreader/util/MergeAdapter$CascadeDataSetObserver;

    const/4 v1, 0x0

    invoke-direct {v0, p0, v1}, Lcom/netease/newsreader/util/MergeAdapter$CascadeDataSetObserver;-><init>(Lcom/netease/newsreader/util/MergeAdapter;Lcom/netease/newsreader/util/MergeAdapter$CascadeDataSetObserver;)V

    invoke-interface {p1, v0}, Landroid/widget/ListAdapter;->registerDataSetObserver(Landroid/database/DataSetObserver;)V

    .line 49
    return-void
.end method

.method public addView(Landroid/view/View;)V
    .locals 1
    .parameter "view"

    .prologue
    .line 57
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/netease/newsreader/util/MergeAdapter;->addView(Landroid/view/View;Z)V

    .line 58
    return-void
.end method

.method public addView(Landroid/view/View;Z)V
    .locals 2
    .parameter "view"
    .parameter "enabled"

    .prologue
    .line 67
    new-instance v0, Ljava/util/ArrayList;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V

    .line 69
    .local v0, list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Landroid/view/View;>;"
    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 71
    invoke-virtual {p0, v0, p2}, Lcom/netease/newsreader/util/MergeAdapter;->addViews(Ljava/util/List;Z)V

    .line 72
    return-void
.end method

.method public addViews(Ljava/util/List;)V
    .locals 1
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Landroid/view/View;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 80
    .local p1, views:Ljava/util/List;,"Ljava/util/List<Landroid/view/View;>;"
    const/4 v0, 0x0

    invoke-virtual {p0, p1, v0}, Lcom/netease/newsreader/util/MergeAdapter;->addViews(Ljava/util/List;Z)V

    .line 81
    return-void
.end method

.method public addViews(Ljava/util/List;Z)V
    .locals 1
    .parameter
    .parameter "enabled"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Landroid/view/View;",
            ">;Z)V"
        }
    .end annotation

    .prologue
    .line 90
    .local p1, views:Ljava/util/List;,"Ljava/util/List<Landroid/view/View;>;"
    if-eqz p2, :cond_0

    .line 91
    new-instance v0, Lcom/netease/newsreader/util/MergeAdapter$EnabledSackAdapter;

    invoke-direct {v0, p1}, Lcom/netease/newsreader/util/MergeAdapter$EnabledSackAdapter;-><init>(Ljava/util/List;)V

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/util/MergeAdapter;->addAdapter(Landroid/widget/ListAdapter;)V

    .line 96
    :goto_0
    return-void

    .line 94
    :cond_0
    new-instance v0, Lcom/commonsware/cwac/sacklist/SackOfViewsAdapter;

    invoke-direct {v0, p1}, Lcom/commonsware/cwac/sacklist/SackOfViewsAdapter;-><init>(Ljava/util/List;)V

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/util/MergeAdapter;->addAdapter(Landroid/widget/ListAdapter;)V

    goto :goto_0
.end method

.method public areAllItemsEnabled()Z
    .locals 1

    .prologue
    .line 198
    const/4 v0, 0x0

    return v0
.end method

.method public getAdapter(I)Landroid/widget/ListAdapter;
    .locals 4
    .parameter "position"

    .prologue
    .line 124
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_1

    .line 134
    const/4 v0, 0x0

    :cond_0
    return-object v0

    .line 124
    :cond_1
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 125
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v1

    .line 127
    .local v1, size:I
    if-lt p1, v1, :cond_0

    .line 131
    sub-int/2addr p1, v1

    goto :goto_0
.end method

.method public getCount()I
    .locals 4

    .prologue
    .line 143
    const/4 v1, 0x0

    .line 145
    .local v1, total:I
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 149
    return v1

    .line 145
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 146
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v3

    add-int/2addr v1, v3

    goto :goto_0
.end method

.method public getItem(I)Ljava/lang/Object;
    .locals 4
    .parameter "position"

    .prologue
    .line 105
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 115
    const/4 v2, 0x0

    :goto_1
    return-object v2

    .line 105
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 106
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v1

    .line 108
    .local v1, size:I
    if-ge p1, v1, :cond_1

    .line 109
    invoke-interface {v0, p1}, Landroid/widget/ListAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v2

    goto :goto_1

    .line 112
    :cond_1
    sub-int/2addr p1, v1

    goto :goto_0
.end method

.method public getItemId(I)J
    .locals 4
    .parameter "position"

    .prologue
    .line 252
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 262
    const-wide/16 v2, -0x1

    :goto_1
    return-wide v2

    .line 252
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 253
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v1

    .line 255
    .local v1, size:I
    if-ge p1, v1, :cond_1

    .line 256
    invoke-interface {v0, p1}, Landroid/widget/ListAdapter;->getItemId(I)J

    move-result-wide v2

    goto :goto_1

    .line 259
    :cond_1
    sub-int/2addr p1, v1

    goto :goto_0
.end method

.method public getItemViewType(I)I
    .locals 6
    .parameter "position"

    .prologue
    .line 174
    const/4 v3, 0x0

    .line 175
    .local v3, typeOffset:I
    const/4 v1, -0x1

    .line 177
    .local v1, result:I
    iget-object v4, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v4

    :goto_0
    invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

    move-result v5

    if-nez v5, :cond_0

    .line 189
    :goto_1
    return v1

    .line 177
    :cond_0
    invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 178
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v2

    .line 180
    .local v2, size:I
    if-ge p1, v2, :cond_1

    .line 181
    invoke-interface {v0, p1}, Landroid/widget/ListAdapter;->getItemViewType(I)I

    move-result v4

    add-int v1, v3, v4

    .line 182
    goto :goto_1

    .line 185
    :cond_1
    sub-int/2addr p1, v2

    .line 186
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getViewTypeCount()I

    move-result v5

    add-int/2addr v3, v5

    goto :goto_0
.end method

.method public getPositionForSection(I)I
    .locals 6
    .parameter "section"

    .prologue
    .line 267
    const/4 v2, 0x0

    .line 269
    .local v2, position:I
    iget-object v4, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v5

    :goto_0
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-nez v4, :cond_0

    .line 289
    const/4 v4, 0x0

    :goto_1
    return v4

    .line 269
    :cond_0
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/widget/ListAdapter;

    .line 270
    .local v1, piece:Landroid/widget/ListAdapter;
    instance-of v4, v1, Landroid/widget/SectionIndexer;

    if-eqz v4, :cond_3

    move-object v4, v1

    .line 271
    check-cast v4, Landroid/widget/SectionIndexer;

    invoke-interface {v4}, Landroid/widget/SectionIndexer;->getSections()[Ljava/lang/Object;

    move-result-object v3

    .line 272
    .local v3, sections:[Ljava/lang/Object;
    const/4 v0, 0x0

    .line 274
    .local v0, numSections:I
    if-eqz v3, :cond_1

    .line 275
    array-length v0, v3

    .line 278
    :cond_1
    if-ge p1, v0, :cond_2

    .line 279
    check-cast v1, Landroid/widget/SectionIndexer;

    .end local v1           #piece:Landroid/widget/ListAdapter;
    invoke-interface {v1, p1}, Landroid/widget/SectionIndexer;->getPositionForSection(I)I

    move-result v4

    add-int/2addr v4, v2

    goto :goto_1

    .line 281
    .restart local v1       #piece:Landroid/widget/ListAdapter;
    :cond_2
    if-eqz v3, :cond_3

    .line 282
    sub-int/2addr p1, v0

    .line 286
    .end local v0           #numSections:I
    .end local v3           #sections:[Ljava/lang/Object;
    :cond_3
    invoke-interface {v1}, Landroid/widget/ListAdapter;->getCount()I

    move-result v4

    add-int/2addr v2, v4

    goto :goto_0
.end method

.method public getSectionForPosition(I)I
    .locals 7
    .parameter "position"

    .prologue
    const/4 v4, 0x0

    .line 294
    const/4 v1, 0x0

    .line 296
    .local v1, section:I
    iget-object v5, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v5}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v5

    :goto_0
    invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z

    move-result v6

    if-nez v6, :cond_1

    .line 319
    :cond_0
    :goto_1
    return v4

    .line 296
    :cond_1
    invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 297
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v3

    .line 299
    .local v3, size:I
    if-ge p1, v3, :cond_2

    .line 300
    instance-of v5, v0, Landroid/widget/SectionIndexer;

    if-eqz v5, :cond_0

    .line 301
    check-cast v0, Landroid/widget/SectionIndexer;

    .end local v0           #piece:Landroid/widget/ListAdapter;
    invoke-interface {v0, p1}, Landroid/widget/SectionIndexer;->getSectionForPosition(I)I

    move-result v4

    add-int/2addr v4, v1

    goto :goto_1

    .line 307
    .restart local v0       #piece:Landroid/widget/ListAdapter;
    :cond_2
    instance-of v6, v0, Landroid/widget/SectionIndexer;

    if-eqz v6, :cond_3

    .line 308
    check-cast v0, Landroid/widget/SectionIndexer;

    .end local v0           #piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/SectionIndexer;->getSections()[Ljava/lang/Object;

    move-result-object v2

    .line 310
    .local v2, sections:[Ljava/lang/Object;
    if-eqz v2, :cond_3

    .line 311
    array-length v6, v2

    add-int/2addr v1, v6

    .line 316
    .end local v2           #sections:[Ljava/lang/Object;
    :cond_3
    sub-int/2addr p1, v3

    goto :goto_0
.end method

.method public getSections()[Ljava/lang/Object;
    .locals 8

    .prologue
    const/4 v5, 0x0

    .line 324
    new-instance v3, Ljava/util/ArrayList;

    invoke-direct {v3}, Ljava/util/ArrayList;-><init>()V

    .line 326
    .local v3, sections:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Ljava/lang/Object;>;"
    iget-object v4, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v4}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_0
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-nez v4, :cond_1

    .line 338
    invoke-virtual {v3}, Ljava/util/ArrayList;->size()I

    move-result v4

    if-nez v4, :cond_2

    .line 339
    const/4 v4, 0x0

    .line 342
    :goto_0
    return-object v4

    .line 326
    :cond_1
    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Landroid/widget/ListAdapter;

    .line 327
    .local v1, piece:Landroid/widget/ListAdapter;
    instance-of v4, v1, Landroid/widget/SectionIndexer;

    if-eqz v4, :cond_0

    .line 328
    check-cast v1, Landroid/widget/SectionIndexer;

    .end local v1           #piece:Landroid/widget/ListAdapter;
    invoke-interface {v1}, Landroid/widget/SectionIndexer;->getSections()[Ljava/lang/Object;

    move-result-object v0

    .line 330
    .local v0, curSections:[Ljava/lang/Object;
    if-eqz v0, :cond_0

    .line 331
    array-length v7, v0

    move v4, v5

    :goto_1
    if-ge v4, v7, :cond_0

    aget-object v2, v0, v4

    .line 332
    .local v2, section:Ljava/lang/Object;
    invoke-virtual {v3, v2}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 331
    add-int/lit8 v4, v4, 0x1

    goto :goto_1

    .line 342
    .end local v0           #curSections:[Ljava/lang/Object;
    .end local v2           #section:Ljava/lang/Object;
    :cond_2
    new-array v4, v5, [Ljava/lang/Object;

    invoke-virtual {v3, v4}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;

    move-result-object v4

    goto :goto_0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 4
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    .line 231
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 242
    const/4 v2, 0x0

    :goto_1
    return-object v2

    .line 231
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 232
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v1

    .line 234
    .local v1, size:I
    if-ge p1, v1, :cond_1

    .line 236
    invoke-interface {v0, p1, p2, p3}, Landroid/widget/ListAdapter;->getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v2

    goto :goto_1

    .line 239
    :cond_1
    sub-int/2addr p1, v1

    goto :goto_0
.end method

.method public getViewTypeCount()I
    .locals 4

    .prologue
    .line 158
    const/4 v1, 0x0

    .line 160
    .local v1, total:I
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 164
    const/4 v2, 0x1

    invoke-static {v1, v2}, Ljava/lang/Math;->max(II)I

    move-result v2

    return v2

    .line 160
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 161
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getViewTypeCount()I

    move-result v3

    add-int/2addr v1, v3

    goto :goto_0
.end method

.method public isEnabled(I)Z
    .locals 4
    .parameter "position"

    .prologue
    .line 208
    iget-object v2, p0, Lcom/netease/newsreader/util/MergeAdapter;->pieces:Ljava/util/ArrayList;

    invoke-virtual {v2}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_0
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-nez v3, :cond_0

    .line 218
    const/4 v2, 0x0

    :goto_1
    return v2

    .line 208
    :cond_0
    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/widget/ListAdapter;

    .line 209
    .local v0, piece:Landroid/widget/ListAdapter;
    invoke-interface {v0}, Landroid/widget/ListAdapter;->getCount()I

    move-result v1

    .line 211
    .local v1, size:I
    if-ge p1, v1, :cond_1

    .line 212
    invoke-interface {v0, p1}, Landroid/widget/ListAdapter;->isEnabled(I)Z

    move-result v2

    goto :goto_1

    .line 215
    :cond_1
    sub-int/2addr p1, v1

    goto :goto_0
.end method
